
//% color="#AA278D" iconWidth=50 iconHeight=40

namespace hongwaimokuai {

    //% block="刷新红外遥控模块数据" blockType="command"    
    export function HongWai_shuaxin(parameter: any, block: any) {
   
    	Generator.addInclude('HongWai_getinclude', '#include <IRremote.h>');
    	Generator.addObject(`ir_item`, `long`, `ir_item;`);
     	Generator.addObject(`IRrecv`, `IRrecv`, `irrecv_7(7);`);   	
     	Generator.addObject(`decode_results`, `decode_results`, `results_7;`);  
     	Generator.addSetup(`irrecv_7.enableIRIn()`, `irrecv_7.enableIRIn();`);   
     	Generator.addCode(`if (irrecv_7.decode(&results_7)) {ir_item=results_7.value;    irrecv_7.resume(); }`)  }

    //% block="红外遥控模块数据" blockType="reporter"    
    export function HongWai_shuju(parameter: any, block: any) {
    Generator.addCode('ir_item')
    }

    //% block="清除红外遥控模块数据" blockType="command"    
    export function HongWai_qingchu(parameter: any, block: any) {
    Generator.addCode('ir_item=0;')     
    }
}
